/**
 *	@project:	kybernetes
 *	@author:	D.Toepel
 *	@note:		---
 *	
 *	Copyright (C) 2009  D.Toepel <de.dtools> {at} <gmail> {dot} <com>
 *	
 *	This program is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.
 *	
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *	
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *	
 */
package dt.htwk.panels;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.util.Hashtable;

import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;

import dt.htwk.core.Kybernetes;
import dt.htwk.extras.SimulationThread;
import dt.htwk.extras.TestServer;
import dt.htwk.res.Resource;

/**
 * <h3>KCAdminPanel</h3>
 *
 * @author DToepel
 * 
 */
public class KCAdminPanel extends JPanel {
	
/* ****************************************************
 * Deklaration der Variablen und Komponenten
 * ***************************************************/
	
	private final boolean DEBUG = true;

	/**
	 * serialVersionUID -- Standard: 1L
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * 
	 */
	private static Hashtable<String, String> lng;
	
	/**
	 * 
	 */
	private static Boolean loggedIn = false;
	
	/*
	 * Panels fuer CardLayout bekanntgeben
	 */
	private JPanel serverSettings;
	private JPanel userGroups;

	

/* ****************************************************
 * Aufruf des Konstruktors
 * ***************************************************/

	/**
	 * @param lng
	 */
	public KCAdminPanel(Hashtable<String, String> lng){
		super(new CardLayout());
		KCAdminPanel.lng = lng;
		initGUI();
	}
	
/* ****************************************************
 * PUBLIC - oeffentliche Methoden
 * ***************************************************/

	/**
	 * Aufruf-String fuer Panel zur Servereinstellung
	 */
	public static String ServerSettings = "ServerSettings";
	
	/**
	 * Aufruf-String fuer Panel zur Benutzerverwalung
	 */
	public static String UserGroups = "UserGroups";
	
	
	public void setLoginStatus(Boolean loggedIn){
		KCAdminPanel.loggedIn = loggedIn;
	}
	
	/**
	 * <h3>showCard</h3>
	 *
	 * @param id
	 */
	public void showCard(String id){
		CardLayout cl = (CardLayout)(this.getLayout());
		cl.show(this, id);
	}
	

/* ****************************************************
 * PRIVATE - nicht-oeffentliche Methoden
 * ***************************************************/

	/**
	 * <h3>initGUI</h3>
	 *
	 */
	private void initGUI(){
		this.add(new CommonSettings(lng), ServerSettings);
		this.add(new CommonUser(lng), UserGroups);
	}

}
